// pages/order/balance/balance.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    cartList: [],
    sumMonney: 0,
    cutMonney: 0,
    cupNumber: 0
  },
  
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
    wx.setNavigationBarTitle({
      title: '订单详情'
    })

    this.setData({
      cartList: wx.getStorageSync('cartList'),
      sumMonney: wx.getStorageSync('sumMonney'),
      cutMonney: wx.getStorageSync('sumMonney') > 19 ? 3 : 0,
      cupNumber: wx.getStorageSync('cupNumber'),
    })
   
  },
  //拿到支付方式
  swiperChange: function (e) {
    var that = this;
    var radioValue = e.detail.value;
    var cartList = this.data.cartList;
    cartList.push(radioValue);
    that.setData({
      value: radioValue,
      cartList: cartList
    })
    console.log(that.data.value);
    
  },
  gopay: function () {
    var cart = this.data.cartList;
    wx.request({
      url: 'http://localhost:8080/isFull-admin/addOrder.action',
      method: 'get',
      data: { cart },
      header: {
        'Accept': 'application/json'
      },
      success: function (res) {
      }
    })
    wx.navigateTo({
      url: '../detail/detail'
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})